import configUrl from '@/api/config.js'

export const upload = (data) => {
	let uploadData = ''
	uni.uploadFile({
		url: configUrl.http_url + '/upload/image',
		filePath: data.file,
		name: 'file',
		formData: {
			type: data.type,
			file: data.file
		},
		header: {
			"Authorization": uni.getStorageSync('token'),

		},
		success: (uploadFileRes) => {
			uploadData = JSON.parse(uploadFileRes.data).data.save_url
		}
	});
	console.log('uploadData:', uploadData)
	return uploadData
}